package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.geom.ColorTransform;
	import flash.utils.Timer;
	
	public class TestColorTransform extends Sprite
	{
		private		var	_sprite:Sprite = null;
		private		var	_count:int = 0;
		public function TestColorTransform()
		{
			super();
			
			var sprite:Sprite = new Sprite();
			sprite.graphics.beginFill(0xff0000);
			sprite.graphics.drawEllipse(20, 20, 100, 50);
			sprite.graphics.endFill();
			this.addChild(sprite);
			this._sprite = sprite;
			
			var timer:Timer = new Timer(1000*2, 5);
			timer.addEventListener(TimerEvent.TIMER, onTime);
			timer.start();
		}
		
		public	function	onTime(evt:TimerEvent):void{
			var colorTrans:ColorTransform = this._sprite.transform.colorTransform;
			if (_count == 0){
				colorTrans.color = 0x000088;
				this._sprite.transform.colorTransform = colorTrans;
			}
			else if(_count == 1){
				colorTrans.redMultiplier = 0;
				colorTrans.greenMultiplier = 0;
				colorTrans.blueMultiplier = 0.5;
				this._sprite.transform.colorTransform = colorTrans;
			}
			else{
				this._sprite.transform.colorTransform = new ColorTransform();
			}
			
			_count++;
			trace("onTime");
		}
	}
}